/*
 * ShowMessageDialog.java
 *
 */
package gui;

/**
 *
 * @author Haitm
 */
public class ShowMessageDialog1 extends javax.swing.JDialog {

    public static final int OK = 1;
    public static final int CANCEL = 0;
    public static final int DEFAULT = -1;
    public static final int MESSAGE = 2;
    public static final int CONFIRM = 3;
    public static int STATUS = 0;

    /** Creates new form ShowMessageDialog */
    public ShowMessageDialog1(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        STATUS = 0;

    }

    public ShowMessageDialog1(java.awt.Frame parent, boolean modal, String confirm_message, String title, int type) {
        super(parent, modal);
        initComponents();
        pnlMessage.setText(confirm_message);
        setTitle(title);
        STATUS = 0;

        if (type == MESSAGE) {
            btnOK.setVisible(false);
            btnCancel.setVisible(false);
            btnMessageOK.setVisible(true);
        } else if (type == CONFIRM) {
            btnOK.setVisible(true);
            btnCancel.setVisible(true);
            btnMessageOK.setVisible(false);
        }

        setLocationRelativeTo(this);
        setVisible(true);
    }

    // <editor-fold defaultstate="collapsed" desc="paint">
    /*
    private Image image = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/images/dialog.png"));;
    @Override
    public void paint(Graphics g){

    g.drawImage(image,0,20,this);
    message.setText(mess);
    add(btnOK);
    add(btnCancel);

    }
     * */
    // </editor-fold>
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        pnlShowM = new javax.swing.JPanel();
        pnlMessage = new javax.swing.JLabel();
        btnOK = new javax.swing.JButton();
        btnCancel = new javax.swing.JButton();
        btnMessageOK = new javax.swing.JButton();
        lblBrush = new javax.swing.JLabel();
        lblBrush2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Message");
        setAlwaysOnTop(true);
        setResizable(false);
        getContentPane().setLayout(new java.awt.GridBagLayout());

        pnlShowM.setBackground(new java.awt.Color(255, 255, 255));
        pnlShowM.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlShowM.setFocusCycleRoot(true);
        pnlShowM.setName("pnlShowM"); // NOI18N
        pnlShowM.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        pnlMessage.setBackground(new java.awt.Color(240, 249, 255));
        pnlMessage.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        pnlMessage.setForeground(new java.awt.Color(3, 97, 145));
        pnlMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        pnlMessage.setText("Message");
        pnlMessage.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        pnlMessage.setName("pnlMessage"); // NOI18N
        pnlShowM.add(pnlMessage, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 16, 320, 50));

        btnOK.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btnOK.setForeground(new java.awt.Color(3, 97, 145));
        btnOK.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_acceptmini.png"))); // NOI18N
        btnOK.setText("OK");
        btnOK.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        btnOK.setMargin(new java.awt.Insets(0, 2, 0, 2));
        btnOK.setName("btnOK"); // NOI18N
        btnOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOKActionPerformed(evt);
            }
        });
        pnlShowM.add(btnOK, new org.netbeans.lib.awtextra.AbsoluteConstraints(96, 86, 80, -1));

        btnCancel.setBackground(new java.awt.Color(255, 255, 255));
        btnCancel.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btnCancel.setForeground(new java.awt.Color(3, 97, 145));
        btnCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_cancel.png"))); // NOI18N
        btnCancel.setText("Cancel");
        btnCancel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        btnCancel.setMargin(new java.awt.Insets(0, 2, 0, 2));
        btnCancel.setName("btnCancel"); // NOI18N
        btnCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelActionPerformed(evt);
            }
        });
        pnlShowM.add(btnCancel, new org.netbeans.lib.awtextra.AbsoluteConstraints(186, 86, 80, -1));

        btnMessageOK.setBackground(new java.awt.Color(255, 255, 255));
        btnMessageOK.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btnMessageOK.setForeground(new java.awt.Color(3, 97, 145));
        btnMessageOK.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/btn_acceptmini.png"))); // NOI18N
        btnMessageOK.setText("OK");
        btnMessageOK.setMargin(new java.awt.Insets(0, 2, 0, 2));
        btnMessageOK.setName("btnMessageOK"); // NOI18N
        btnMessageOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMessageOKActionPerformed(evt);
            }
        });
        pnlShowM.add(btnMessageOK, new org.netbeans.lib.awtextra.AbsoluteConstraints(146, 86, 70, 30));

        lblBrush.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/Banner_brush_mini.png"))); // NOI18N
        lblBrush.setName("lblBrush"); // NOI18N
        pnlShowM.add(lblBrush, new org.netbeans.lib.awtextra.AbsoluteConstraints(136, 6, -1, 210));

        lblBrush2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/Banner_brush_TopMiNi.png"))); // NOI18N
        lblBrush2.setName("lblBrush2"); // NOI18N
        pnlShowM.add(lblBrush2, new org.netbeans.lib.awtextra.AbsoluteConstraints(-4, -4, 200, 210));

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        getContentPane().add(pnlShowM, gridBagConstraints);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
        STATUS = CANCEL;
        dispose();
}//GEN-LAST:event_btnCancelActionPerformed

    private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
        STATUS = OK;
        dispose();
}//GEN-LAST:event_btnOKActionPerformed

    private void btnMessageOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMessageOKActionPerformed
        dispose();
    }//GEN-LAST:event_btnMessageOKActionPerformed
    /**
     * @param args the command line arguments
     */
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancel;
    private javax.swing.JButton btnMessageOK;
    private javax.swing.JButton btnOK;
    private javax.swing.JLabel lblBrush;
    private javax.swing.JLabel lblBrush2;
    private javax.swing.JLabel pnlMessage;
    private javax.swing.JPanel pnlShowM;
    // End of variables declaration//GEN-END:variables
}
